﻿using Domain.Entity;
using DtoFw;
using Repository.Base;
using Util;

namespace Repository
{
    public class MainRoleRepository : BaseRepository<MainRoleEntity>
    {
        private readonly SnowFlakeGenerator worker;
        public MainRoleRepository(SnowFlakeGenerator snowFlakeGenerator) : base(snowFlakeGenerator)
        {
            this.worker = snowFlakeGenerator;
        }
        /// <summary>
        /// 角色
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public Pager<MainRoleEntity> GetPagerList(BaseQuery query)
        {
            return base.GetPager(query, linq =>
            {
                linq = linq.Where(t => !t.IsDeleted);
                if (!string.IsNullOrEmpty(query.Name))
                    linq = linq.Where(t => t.Name.Contains(query.Name));
                return linq;
            });
        }
    }
}
